<?php
session_start();
      if (isset($_SESSION['k_username'])) {
?>
<html>
<head>
<? if($_SESSION['grupo']==5 ){ ?>
<link rel="stylesheet" href="../../css/stylecdm.css" type="text/css" />
<? }else{ ?>
<link rel="stylesheet" href="../../css/style1.css" type="text/css" />
<? } ?>
<style type="text/css">
<!--
.Estilo1 {font-size: 24px}
-->
</style>
<title >Tipo Socio</title>
<link rel="stylesheet" type="text/css" media="all" href="../../calendario/calendar-green.css" title="win2k-cold-1" /> 
 <!-- librería principal del calendario -->
 <script type="text/javascript" src="../../calendario/calendar.js"></script>

 <!-- librería para cargar el lenguaje deseado -->
  <script type="text/javascript" src="../../calendario/lang/calendar-es.js"></script>

  <!-- librería que declara la función Calendar.setup, que ayuda a generar un calendario en unas pocas líneas de código -->
  <script type="text/javascript" src="../../calendario/calendar-setup.js"></script>    
  <script type="text/javascript" src="../../js/funciones.js"></script>    
<script type="text/javascript">

var pagina = 'http://intranet.gotica.com.pe/modulos/socios/barracomprueba.php';

function redireccion() {

document.location.href=pagina;

}

setTimeout("redireccion()",2000);

</script>
</head>
<body>
<?php 

  include('../../conexion.inc.php');
  $link = Conectarse();

mysql_select_db("gotica_sociosgotica",$link);
$comp=$_POST['comp'];
$m=date("m");
if(($comp=="SAB-112") || ($comp=="SAB-212") || ($comp=="SAB-312") || ($comp=="SAB-412") || ($comp=="VIE-112") || ($comp=="VIE-212") || ($comp=="VIE-312") || ($comp=="VIE-412") || ($comp=="JUE-112") || ($comp=="JUE-212") || ($comp=="JUE-312") || ($comp=="JUE-412") ||    ($comp=="SAB-111") || ($comp=="SAB-211") || ($comp=="SAB-311") || ($comp=="SAB-411") || ($comp=="VIE-111") || ($comp=="VIE-211") ||    ($comp=="VIE-311") || ($comp=="VIE-411") || ($comp=="JUE-111") || ($comp=="JUE-211") || ($comp=="JUE-311") || ($comp=="JUE-411") ||    ($comp=="SAB-110") || ($comp=="SAB-210") || ($comp=="SAB-310") || ($comp=="SAB-410") || ($comp=="VIE-110") || ($comp=="VIE-210") ||    ($comp=="VIE-310") || ($comp=="VIE-410") || ($comp=="JUE-110") || ($comp=="JUE-210") || ($comp=="JUE-310") || ($comp=="JUE-410") || ($comp=="000") ){

$fecha = date("y-m-d h:i:s");
$sql2="INSERT INTO Dias ( fechahora, codigo) VALUES ( '$fecha', '$comp')";
$resulta = mysql_query($sql2);
echo "REGISTRADO CON EXITO";

}
else
{
$sql="SELECT socios.*, socio_tiposocio.vez, socio_tiposocio.idtiposocio  FROM socios, socio_tiposocio WHERE socio_tiposocio.codigo LIKE '$_POST[comp]' AND socio_tiposocio.idsocio=socios.idsocio ";
$result= mysql_query($sql, $link);
$row= mysql_fetch_array($result);
?>

<table width="100%" border="0" cellspacing="2" cellpadding="2" align="center" >
<tr align="center" class="dataheader">
<td colspan="2">DATOS DE  SOCIO</td>
</tr>

<?
$cont= $row['vez'];
$cont++;
$sql2="UPDATE  socio_tiposocio SET vez='$cont' WHERE idsocio='$row[idsocio]' AND idtiposocio= '$row[idtiposocio]' ";
$result2= mysql_query($sql2, $link);

echo "<tr class=\"data\">";


if (!$row['foto']){
echo "<td rowspan=\"5\" ><img src=\"fotos/fotosocio.jpg\" /></td>";
}
else
{
echo "<td rowspan=\"5\" ><img src=\"'row[foto]'\" /></td>";
}

echo "<td>Codigo :".$_POST['comp']."</TD></tr><tr class=\"data\"><td>Nombres:".$row['Nombres']."</td></tr>";
echo "<tr class=\"data\"><td> Apellidos :".$row['ApPaterno']." ".$row['ApMaterno']."</td></tr>";
echo "<tr class=\"data\"><td> DNI :".$row['DNI']."</td></tr>";
echo "<tr class=\"data\"><td> VECES: ".$cont."</td></tr>";
echo "<tr class=\"data\"> <td colspan=\"2\" align=\"center\" > <IMG SRC=\"barcode.php?barcode=$_POST[comp]&width=300&height=50&format=\"jpeg\"&quality=100\"></td>";
echo "</tr></table>";

?>

</body>
</html>

<?
}


}
?>